package gao.xiaolei.dao;

import gao.xiaolei.entity.AuthVersion;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;

@Repository("AuthVersionDao")
public interface AuthVersionDao extends JpaRepository<AuthVersion,String> {

    @Modifying
    @Query(value = "update AuthVersion set loginTime =:loginTime where userId =:userId")
    public void updateLoginTime(@Param("loginTime") LocalDateTime loginTime,
                                @Param("userId") String userId);

    @Modifying
    @Query(value = "update AuthVersion set version =:version where userId =:userId")
    public void updateVersion(@Param("version") Integer version,
                              @Param("userId") String userId);
}
